package com.example.hotHub.model;

import lombok.Data;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;

import java.io.Serializable;
import java.util.Map;

@Slf4j
@Data
@Accessors(chain = true)
public class NormalHotSearch implements Comparable<NormalHotSearch>, Serializable {

    private static final long serialVersionUID = 1L;

    String title;
    String url;
    Integer hotValue;
    String hotValueUnit;
    String imageUrl;
    String videoUrl;
    String describe;
    String videoName;
    Map<String, String> ext;

    @Override
    public int compareTo(NormalHotSearch o) {
        try {
            if (o.getHotValue() == null) {
                return 0;
            }
            return this.hotValue.compareTo(o.hotValue);
        } catch (Exception e) {
            log.error("normalHotSearch: {}, exception", o, e);
            return -1;
        }

    }

    @Override
    public String toString() {
        return "{" +
                "title='" + title + '\'' +
                ", url='" + url + '\'' +
                ", hotValue=" + hotValue +
                ", hotValueUnit='" + hotValueUnit + '\'' +
                ", imageUrl='" + imageUrl + '\'' +
                ", describe='" + describe + '\'' +
                "}\n";
    }
}
